import { createApp } from 'vue'
import '@/styles/skin.scss'
import App from '@/App.vue'
import router from '@/router'
import { createPinia } from "pinia";
import piniaPersistedstate from 'pinia-plugin-persistedstate';
import 'element-plus/dist/index.css'
import hasRole from '../utils/directives/hasRole'
import hasRoleShow from '../utils/directives/hasRoleShow'
import LoadingSpinner from '@/views/components/LoadingSpinner.vue'


const pinia = createPinia();

                                 
import 'viewerjs/dist/viewer.css'
import VueViewer from 'v-viewer'


// 使用icon
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
pinia.use(piniaPersistedstate)
const app = createApp(App).use(router).use(pinia)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.directive('has-role', hasRole); 
app.directive('has-role-show', hasRoleShow); 
app.use(VueViewer)
app.component('LoadingSpinner', LoadingSpinner)


// 设置中文环境
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'amfe-flexible'
app.use(ElementPlus, {
  locale: zhCn,
})
app.mount('#app')